﻿@model ESupervision.ViewModels.DashboardSumarising
@{
    ViewBag.Title = "Staff Dashboad";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Staff Dashboad</h2>
@using (Html.BeginForm())
{
    <div class="row" style="margin:20px 0; text-align:center;">
        <b>Find by name:</b> @Html.TextBox("SearchString")
        <button class="btn btn-success" type="submit"><span class="glyphicon glyphicon-search" /> Search</button>
    </div>
}

<div class="row">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title" id="panel-title">Your Students<a class="anchorjs-link" href="#panel-title"><span class="anchorjs-icon"></span></a></h3>
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table class="table table-hover table-condensed">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>@Html.ActionLink("First Name", "StaffDashboard", new { sortOrder = ViewBag.FstNameSortParm })</th>
                            <th>@Html.ActionLink("Last Name", "StaffDashboard", new { sortOrder = ViewBag.LstNameSortParm })</th>
                            <th>@Html.ActionLink("Birthday", "StaffDashboard", new { sortOrder = ViewBag.BirthdaySortParm })</th>
                            <th>Phone</th>
                            <th>Email</th>
                            <th>@Html.ActionLink("Enrollment Date", "StaffDashboard", new { sortOrder = ViewBag.DateSortParm })</th>
                            <th>Address</th>
                            <th>@Html.ActionLink("Supervision", "StaffDashboard", new { sortOrder = ViewBag.SupervisorSortParm })</th>
                            <th>@Html.ActionLink("Second Marker", "StaffDashboard", new { sortOrder = ViewBag.MakerSortParm })</th>
                            <th>@Html.ActionLink("Staff Enrollment", "StaffDashboard", new { sortOrder = ViewBag.StaffSortParm })</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            int count = 0;
                            foreach (var item in Model.Students)
                            {
                                count++;
                                <tr onclick="window.document.location='@Url.Action("StudentDetails", new { id = item.Id })'">
                                    <td>@count</td>
                                    <td>@item.FirstName</td>
                                    <td>@item.LastName</td>
                                    <td>@item.Birthday.ToShortDateString()</td>
                                    <td>@item.Phone</td>
                                    <td>@item.Email</td>
                                    <td>@item.EnrollmentDate.ToShortDateString()</td>
                                    <td>
                                        @{ string TempAddress = item.Address;
                                         if (TempAddress.Length > 100)
                                         {
                                             TempAddress = TempAddress.Substring(0, 100) + " ...";
                                         }
                                        }
                                        @TempAddress
                                    </td>
                                    <td>@item.Supervisor.FullName</td>
                                    <td>@item.SecondMarker.FullName</td>
                                    <td>@item.AuthorisedStaff.FullName</td>
                                    <td>@Html.ActionLink("Details", "StudentDetails", new { id = item.Id }, null)</td>
                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

